<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="computerRoomList" checkbox="false" fitColumns="true" title="实验室预约" actionUrl="computerRoomController.do?applyListdatagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="labid"  field="lab.id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="名称"  field="lab.name"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="编号"  field="lab.no"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="地址"  field="lab.address"  hidden="false"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="备注"  field="lab.remark"   hidden="false"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="开放时间"  field="lab.beginDate" queryMode="single"  width="120" formatter="yyyy-MM-dd hh:mm"></t:dgCol>
   <t:dgCol title="结束时间"  field="lab_endDate" queryMode="single"  width="120" formatter="yyyy-MM-dd hh:mm"></t:dgCol>
   <t:dgCol title="开放中"  field="lab_closed" queryMode="single"  width="120" formatterjs="getCloseState"></t:dgCol>
<%--    <t:dgCol title="单价(元/小时)"  field="lab.price"  queryMode="single"  width="120"></t:dgCol> --%>
   <t:dgCol title="操作" field="opt" width="130"></t:dgCol>
   <t:dgFunOpt title="预约" funname="selectSeats" exp="lab_closed#eq#false"></t:dgFunOpt> 
  </t:datagrid>
  </div>
 </div>
  <script type="text/javascript">

  function getCloseState(v){
	  if(v=="true"){
		  return "<span style='color:gray;'>否</span>";
	  }else{
		  return "<span style='color:green;font-weight:bold;'>是</span>";
	  }
  }
  
function selectSeats(index){
	var count = ${count};
	if(count == 0){
		tip("您未获取实验室开放预约资格，请获取后再预约");
		return;
	}
	
	var row = $('#computerRoomList').datagrid("getRows");
	var id = row[index]['lab.id'];
	  var addurl = 'computerRoomController.do?selectSeats&id='+id;
	  $.dialog({
		  	id:'selectSeatsDialog',
			content: 'url:'+addurl,
			lock : true,
			zIndex: 1000, 
			width:900,
			height:500,
			title:'选择预约机床', 
			opacity : 0.3,
			cache:false,
		    cancelVal: '关闭',
		    cancel: true
		});
}
 </script>